var contactCustomerFun={
	inits:function(){
		this.ajax();
		this.addBusinessFun();
	},
	Interface:{
		contactCustomer:"http://ww.yc630.com/api/index.php/Buyer/User/contactCustomer",  //预约客服
		kefu:"http://ww.yc630.com/api/index.php/Buyer/User/kefu"//客服
	},
	ajax:function(){
		common.ajaxFun(contactCustomerFun.Interface.kefu,"POST",{token:token},contactCustomerFun.kefuFun); //客服列表

	},
	kefuFun:function(res){
		var str="";//connectionNow
		$.each(res.data,function(i,v){
			str+="<li><span>客服"+v.id+"：</span><em>"+v.name+"</em> <a href=tel:"+v.phone+">"+v.phone+"</a></li>"
		});
		$("#connectionNow").html(str)
		console.log(res)
	},
	addBusinessFun:function(){
		var subBtn=$("#subBtn"),
			name=$("#name"),
			visitime=$("#visitime"),
			problem=$("#problem"),
			contacts=$("#contacts"),
			phone=$("#phone"),
			Obj={};

		subBtn.on("click",function(){
			if(common.checkNull(name.val())){
				alert("预约人姓名不能为空");
				return;
			}else if (common.checkNull(visitime.val())) {
				alert("接受回访时间不能为空");
				return;
			}else if (common.checkNull(problem.val())) {
				alert("问题描述不能为空");
				return;
			}else if (common.checkNull(phone.val())) {
				alert("联系方式不能为空");
				return;
			}else {
				addObj={
					name:name.val(),
					visitime:visitime.val(),
					problem:problem.val(),
					phone:phone.val(),
					token:token
				}
		common.ajaxFun(contactCustomerFun.Interface.contactCustomer,"POST",addObj,function(res){
			if (res.code==0) {
				alert(res.msg)
			}else{
				alert(res.msg)
			};
		}); //商家入驻
			}
		})
	}
}

contactCustomerFun.inits();